package com.qfedu.dao;

import com.qfedu.entity.Function;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface FunctionDao extends JpaRepository<Function,Long> {

    @Query(value = "select f.* from function_ f join functionwithgroup fwg " +
            " on f.id = fwg.function_id where fwg.group_id = ?1",nativeQuery = true)
    List<Function> selectFunctionByGroupId(Long groupId);

    List<Function> findAll();
}
